package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysWorkRoomMapper;
import com.ruoyi.system.domain.SysWorkRoom;
import com.ruoyi.system.service.ISysWorkRoomService;

/**
 * 车间信息Service业务层处理
 * 
 * @author spark
 * @date 2023-07-23
 */
@Service
public class SysWorkRoomServiceImpl implements ISysWorkRoomService 
{
    @Autowired
    private SysWorkRoomMapper sysWorkRoomMapper;

    /**
     * 查询车间信息
     * 
     * @param roomId 车间信息主键
     * @return 车间信息
     */
    @Override
    public SysWorkRoom selectSysWorkRoomByRoomId(Long roomId)
    {
        return sysWorkRoomMapper.selectSysWorkRoomByRoomId(roomId);
    }

    /**
     * 查询车间信息列表
     * 
     * @param sysWorkRoom 车间信息
     * @return 车间信息
     */
    @DataScope(deptAlias = "d")
    @Override
    public List<SysWorkRoom> selectSysWorkRoomList(SysWorkRoom sysWorkRoom)
    {
        return sysWorkRoomMapper.selectSysWorkRoomList(sysWorkRoom);
    }

    /**
     * 新增车间信息
     * 
     * @param sysWorkRoom 车间信息
     * @return 结果
     */
    @Override
    public int insertSysWorkRoom(SysWorkRoom sysWorkRoom)
    {
        sysWorkRoom.setCreateTime(DateUtils.getNowDate());
        return sysWorkRoomMapper.insertSysWorkRoom(sysWorkRoom);
    }

    /**
     * 修改车间信息
     * 
     * @param sysWorkRoom 车间信息
     * @return 结果
     */
    @Override
    public int updateSysWorkRoom(SysWorkRoom sysWorkRoom)
    {
        sysWorkRoom.setUpdateTime(DateUtils.getNowDate());
        return sysWorkRoomMapper.updateSysWorkRoom(sysWorkRoom);
    }

    /**
     * 批量删除车间信息
     * 
     * @param roomIds 需要删除的车间信息主键
     * @return 结果
     */
    @Override
    public int deleteSysWorkRoomByRoomIds(Long[] roomIds)
    {
        return sysWorkRoomMapper.deleteSysWorkRoomByRoomIds(roomIds);
    }

    /**
     * 删除车间信息信息
     * 
     * @param roomId 车间信息主键
     * @return 结果
     */
    @Override
    public int deleteSysWorkRoomByRoomId(Long roomId)
    {
        return sysWorkRoomMapper.deleteSysWorkRoomByRoomId(roomId);
    }
}
